﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using System.Transactions;

namespace Tema2_Adabd.DataLayer
{
    public partial class AccesBazaDeDate
    {
        public void salveazaColoane(string numeVechi,string numeNou,int codUnic, int stoc, byte[] imagine, string descriereProdus,
            string continutProdus, string numeBrand, decimal pret, int in_gestiune, int id_parinte, string numeUser)
        {
            using (var db = new Tema2Entities1())
            {
                db.EditareProdus(numeVechi, numeNou, numeBrand, codUnic, stoc, descriereProdus, continutProdus, id_parinte,
                  imagine,  numeUser);
                throw new Exception("Modifica editare");
            }
        }

        public List<string> branduri()
        {
            List<string> brands;
            using (var db = new Tema2Entities1())
            {
                brands = db.BranduriE().ToList();
            }
            return brands;
        }

        public bool existaCodUnic(int codUnic)
        {
            int count = 0;
            using (var db = new Tema2Entities1())
            {
                count = (from Produse in db.Produses
                         where Produse.cod_unic == codUnic
                         select Produse).Count();
            }
            if (count > 0)
                return true;
            else
                return false;
        }

        //............
    }
}